<template>
	<view class="empty-content" :class="[{full: full}]">
		<image class="empty-content-image" :src="setSrc" mode="aspectFit"></image>
		<text class="empty-content-text text-gray">暂无关内容</text>
	</view>
</template>

<script>
	export default {
		props: {
			src: {
				type: String,
				default: 'empty'
			},
			full: {
				type: Boolean,
				default: false
			},
		},

		data() {
			return {
				typeSrc: {
					empty: '/static/img/img_wuhuodong.png',
				},
			}
		},

		computed: {
			setSrc() {
				if (!/\.(gif|jpg|jpeg|png|GIF|JPEG|JPG|PNG)$/.test(this.src)) {
					return this.typeSrc[this.src];
				}
				return this.src
			},
		}
	}
</script>

<style lang="scss">
	.empty-content {
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
		min-height: 400rpx;
		&.full{
			position: fixed;
			left: 0;
			top: 0;
			right: 0;
			bottom: 0;
			background: $page-color-base;
			padding-bottom: 120upx;
		}
		&-image {
			width: 200upx;
			height: 200upx;
		}
		&-text {
			margin-top: 10rpx;
		}
	}
</style>
